home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume37 / linkedlist / patch01 < prev    next >
Encoding:
Text File  |  1993-05-30  |  57.5 KB  |  2,342 lines

  1. Newsgroups: comp.sources.misc
  2. From: anita@bouw.tno.nl (Anita Eijs)
  3. Subject: v37i088:  linkedlist - Generic Linked List Package, Patch01
  4. Message-ID: <1993May29.174307.16758@sparky.imd.sterling.com>
  5. X-Md4-Signature: d59fd7cbaf8f6a1cca7f46574d0627ec
  6. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Sat, 29 May 1993 17:43:07 GMT
  9. Approved: kent@sparky.imd.sterling.com
  10.  
  11. Submitted-by: anita@bouw.tno.nl (Anita Eijs)
  12. Posting-number: Volume 37, Issue 88
  13. Archive-name: linkedlist/patch01
  14. Environment: UNIX, MS-DOS, VAX/VMS, Macintosh, Amiga
  15. Patch-To: linkedlist: Volume 37, Issue 36-37
  16.  
  17. Below is the patch for the Generic Linked List Package. This
  18. brings the Generic Linked List Package from version 0.8 to
  19. version 0.9.  Apply with 'patch -p < patch1'.
  20.  
  21. The sources of the Generic Linked List Package 0.9 are also
  22. available as shar file (linkedlist0.9.shar) in the FTP archive
  23. of TNO (ftp.tno.nl or hermes.bouw.tno.nl) in the directory
  24. /pub/TNO/BOUW/Bouwinf.
  25.  
  26. The Generic Linked List Package is a package to define, create,
  27. update, query and delete one or more (nodes of) linked lists,
  28. to sort linked lists, and so on. The user doesn't have to take
  29. care of allocating a number of bytes for a node, inserting on
  30. the right place, deleting and freeing a node and so on.
  31.  
  32.         Anita
  33.  
  34.     +--------------------------------------------------------+
  35.     | TNO - BOUW, PO-box 49, 2600 AA  Delft, The Netherlands |
  36.     | FAX : +31 15 122182         E-MAIL : anita@bouw.tno.nl |
  37.     +--------------------------------------------------------+
  38.  
  39. ---------- cut here : linkedlist - patch1 --------------------------------
  40. #! /bin/sh
  41. # This is a shell archive.  Remove anything before this line, then feed it
  42. # into a shell via "sh file" or similar.  To overwrite existing files,
  43. # type "sh file -c".
  44. # Contents:  Makefile.Amiga ReadMe.Amiga ReadMe.BCC patch1
  45. # Wrapped by kent@sparky on Sat May 29 12:36:47 1993
  46. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  47. echo If this archive is complete, you will see the following message:
  48. echo '          "shar: End of archive 1 (of 1)."'
  49. if test -f 'Makefile.Amiga' -a "${1}" != "-c" ; then 
  50.   echo shar: Will not clobber existing file \"'Makefile.Amiga'\"
  51. else
  52.   echo shar: Extracting \"'Makefile.Amiga'\" \(1085 characters\)
  53.   sed "s/^X//" >'Makefile.Amiga' <<'END_OF_FILE'
  54. X# Generic Linked List
  55. X#
  56. X# Anita Eijs, TNO-BOUW, BouwInformatica, September 1989
  57. X# Amiga Port By James Diffendaffer, May 1993
  58. X# SAS 6.0 Makefile
  59. X
  60. XCC    = sc
  61. XASM    = asm
  62. XLINK    = slink
  63. XSTARTUP    = lib:c.o
  64. X#MYLIBS    = 
  65. XCFLAGS    = streq strmer nominc nostkchk ansi noicons \
  66. X    DEF=ANSI DEF=AMIGA IGN=88 IGN=304
  67. XAFLAGS    = -iInclude:
  68. XLFLAGS    = BATCH SC ND
  69. X# DEFINE ___main=___tinymain
  70. X
  71. XAPP        = example
  72. XHFL        = list.h
  73. XCFILES    = example.c sorted.c sorttest.c list.c
  74. XOFILES    = example.o sorted.o sorttest.o list.o
  75. XHFILES    = list.h
  76. X
  77. Xexample:    example.o list.o sorted sorttest Makefile.Amiga
  78. X    $(LINK) FROM $(STARTUP) example.o list.o \
  79. X    LIB lib:sc.lib lib:amiga.lib \
  80. X    TO example ${LFLAGS}
  81. Xsorted:    sorted.o list.o Makefile.Amiga
  82. X    $(LINK) FROM $(STARTUP) sorted.o list.o \
  83. X    LIB lib:sc.lib lib:amiga.lib \
  84. X    TO sorted ${LFLAGS}
  85. Xsorttest:    sorttest.o list.o Makefile.Amiga
  86. X    $(LINK) FROM $(STARTUP) sorttest.o list.o \
  87. X    LIB lib:sc.lib lib:amiga.lib \
  88. X    TO sorttest ${LFLAGS}
  89. X
  90. Xexample.o:
  91. X    $(CC) $(CFLAGS) example.c
  92. X
  93. Xsorted.o:
  94. X    $(CC) $(CFLAGS) sorted.c
  95. X
  96. Xsorttest.o:
  97. X    $(CC) $(CFLAGS) sorttest.c
  98. X
  99. Xlist.o:
  100. X    $(CC) $(CFLAGS) list.c
  101. END_OF_FILE
  102.   if test 1085 -ne `wc -c <'Makefile.Amiga'`; then
  103.     echo shar: \"'Makefile.Amiga'\" unpacked with wrong size!
  104.   fi
  105.   # end of 'Makefile.Amiga'
  106. fi
  107. if test -f 'ReadMe.Amiga' -a "${1}" != "-c" ; then 
  108.   echo shar: Will not clobber existing file \"'ReadMe.Amiga'\"
  109. else
  110.   echo shar: Extracting \"'ReadMe.Amiga'\" \(662 characters\)
  111.   sed "s/^X//" >'ReadMe.Amiga' <<'END_OF_FILE'
  112. XThe included makefile for the Amiga is for SAS C 6.0,
  113. Xif you have something else you'll have to modify it.
  114. XBTW, this was a quick-n-dirty makefile, so don't yell
  115. Xat me if you don't like the way it's set up.
  116. XI only put in a couple hours on it (max), don't expect
  117. Xperfection... it works.
  118. XThe makefile does not build a link library.
  119. X
  120. XJust type "smake -f Makefile.Amiga" to build the
  121. Xexamples.
  122. X
  123. XDon't add the time optimization flag "OPT OPTTIME" to
  124. Xthe CFLAGS line of Makefile.Amiga, because this option
  125. Xcauses some problems with the HEAP sorting algorithm.
  126. X
  127. XIf you have questions regarding the Amiga port, you can
  128. Xsend email to:
  129. X
  130. XJames Diffendaffer
  131. Xslwjt@cc.usu.edu
  132. END_OF_FILE
  133.   if test 662 -ne `wc -c <'ReadMe.Amiga'`; then
  134.     echo shar: \"'ReadMe.Amiga'\" unpacked with wrong size!
  135.   fi
  136.   # end of 'ReadMe.Amiga'
  137. fi
  138. if test -f 'ReadMe.BCC' -a "${1}" != "-c" ; then 
  139.   echo shar: Will not clobber existing file \"'ReadMe.BCC'\"
  140. else
  141.   echo shar: Extracting \"'ReadMe.BCC'\" \(614 characters\)
  142.   sed "s/^X//" >'ReadMe.BCC' <<'END_OF_FILE'
  143. XThe makefile for Borland C++ v3.1 is made by Gabe Helou
  144. X(gabe@angus.mi.org). If you have any questions regarding
  145. Xthis port, don't ask me, but send mail to Gabe.
  146. X
  147. XShane S. Brath (shane.s.brath@uwrf.edu) suggested to add
  148. Xthe following line to the top of list.c on one line :
  149. X
  150. X#pragma option -ml -v -vi- -w-ret -w-nci -w-inl -wamp -w-par -w-cpt -w-dup -w-pia -w-ill -w-sus -wstv -w-ext -w-ias -w-ibc -w-pre -w-nst -A -G -O2 -w-sus -w-aus -w-par -w-pro -w-rvl
  151. X
  152. XThe addition of the pragma line was meant for Borland and
  153. Xother MSDOS C compilers. The Microsoft C compiler (5.10)
  154. Xgives a warning on this line.
  155. X
  156. XAnita Eijs
  157. END_OF_FILE
  158.   if test 614 -ne `wc -c <'ReadMe.BCC'`; then
  159.     echo shar: \"'ReadMe.BCC'\" unpacked with wrong size!
  160.   fi
  161.   # end of 'ReadMe.BCC'
  162. fi
  163. if test -f 'patch1' -a "${1}" != "-c" ; then 
  164.   echo shar: Will not clobber existing file \"'patch1'\"
  165. else
  166.   echo shar: Extracting \"'patch1'\" \(50341 characters\)
  167.   sed "s/^X//" >'patch1' <<'END_OF_FILE'
  168. X*** ../CHANGES    Wed May 19 15:57:55 1993
  169. X--- CHANGES    Wed May 19 15:39:41 1993
  170. X***************
  171. X*** 1,5 ****
  172. X! Most important changes from version 0.7 to version 0.8 :
  173. X  
  174. X  -    Routine lIndxNode is renamed to lGetIndxNode.
  175. X  
  176. X  -    Routine lFlagNode is renamed to lFndFlagNode.
  177. X--- 1,16 ----
  178. X! Most important changes from version 0.8 to version 0.9 (May 1993) :
  179. X  
  180. X+ -    Bug solved in the heap sorting algorithm.
  181. X+ 
  182. X+ -    Ported to Amiga by James Diffendaffer.
  183. X+ 
  184. X+ -    Some additional porting solutions for Borland and other MSDOS C
  185. X+     compilers by Shane Brath).
  186. X+ 
  187. X+ --------------------------------------------------------------------------------
  188. X+ 
  189. X+ Most important changes from version 0.7 to version 0.8 (March 1993) :
  190. X+ 
  191. X  -    Routine lIndxNode is renamed to lGetIndxNode.
  192. X  
  193. X  -    Routine lFlagNode is renamed to lFndFlagNode.
  194. X***************
  195. X*** 10,12 ****
  196. X--- 21,67 ----
  197. X      lSort.
  198. X  
  199. X  -    Defines are made more specific; FIRST is renamed to lFIRST, etc.
  200. X+ 
  201. X+ --------------------------------------------------------------------------------
  202. X+ 
  203. X+ Most important changes from version 0.6 to version 0.7 (March 1992) :
  204. X+ 
  205. X+ -    Ported to Macintosh by Vincent van Gentevoort.
  206. X+ 
  207. X+ -    New routine 'lFlagNode'.
  208. X+ 
  209. X+ --------------------------------------------------------------------------------
  210. X+ 
  211. X+ Most important changes from version 0.5 to version 0.6 (December 1991) :
  212. X+ 
  213. X+ -    Ported to VAX/VMS by Anita Eijs & Rene Balkenende.
  214. X+ 
  215. X+ --------------------------------------------------------------------------------
  216. X+ 
  217. X+ Most important changes from version 0.4 to version 0.5  (February 1991) :
  218. X+ 
  219. X+ -    Return type for each routine.
  220. X+ 
  221. X+ --------------------------------------------------------------------------------
  222. X+ 
  223. X+ Most important changes from version 0.3 to version 0.4 (November 1990) :
  224. X+ 
  225. X+ -    New routines 'lDump' and 'lUndump'.
  226. X+ 
  227. X+ --------------------------------------------------------------------------------
  228. X+ 
  229. X+ Most important changes from version 0.2 to version 0.3 (September 1990) :
  230. X+ 
  231. X+ -    New routine 'lError'.
  232. X+ 
  233. X+ --------------------------------------------------------------------------------
  234. X+ 
  235. X+ Most important changes from version 0.1 to version 0.2 (April 1990) :
  236. X+ 
  237. X+ -    New routine 'lIndxNode'.
  238. X+ 
  239. X+ --------------------------------------------------------------------------------
  240. X+ 
  241. X+ Version 0.1 (May 1989) :
  242. X+ 
  243. X+ -    Created by Anita Eijs, TNO-BOUW, BouwInformatica.
  244. X*** ../README    Mon May  3 12:58:56 1993
  245. X--- README    Tue May 25 15:23:21 1993
  246. X***************
  247. X*** 2,8 ****
  248. X                  ===================
  249. X  
  250. X  
  251. X! The distribution of the Generic Linked List package (Version 0.8, May 1993)
  252. X  includes the following files:
  253. X  
  254. X      Doc/Intro.3        - [nt]roff manual pages
  255. X--- 2,8 ----
  256. X                  ===================
  257. X  
  258. X  
  259. X! The distribution of the Generic Linked List package (Version 0.9, May 1993)
  260. X  includes the following files:
  261. X  
  262. X      Doc/Intro.3        - [nt]roff manual pages
  263. X***************
  264. X*** 26,31 ****
  265. X--- 26,34 ----
  266. X      Doc/lUpdNode.3
  267. X      Makefile        - Berkeley or System V Makefile
  268. X      Makefile.BCC        - Borland C++ v3.1 Makefile
  269. X+     ReadMe.BCC        - some additional info about Borland port
  270. X+     Makefile.Amiga        - Amiga SAS C 6.0 Makefile
  271. X+     ReadMe.Amiga        - some additional info about Amiga port
  272. X      README            - this file !
  273. X      CHANGES            - list of changes
  274. X      Tools_makerule        - make rules for Makefile
  275. X***************
  276. X*** 43,51 ****
  277. X  
  278. X  2)    Check the environment settings (RANLIB) in the Tools_makerule.
  279. X  
  280. X! 3)    Enter 'make newlib' at the UNIX prompt.
  281. X  
  282. X! 4)    Enter 'make test' or 'make example' to create the executable of
  283. X      the program 'example' at the UNIX prompt.
  284. X  
  285. X  
  286. X--- 46,56 ----
  287. X  
  288. X  2)    Check the environment settings (RANLIB) in the Tools_makerule.
  289. X  
  290. X! 3)    Be sure that the LIB-directory is created.
  291. X  
  292. X! 4)    Enter 'make newlib' at the UNIX prompt.
  293. X! 
  294. X! 5)    Enter 'make test' or 'make example' to create the executable of
  295. X      the program 'example' at the UNIX prompt.
  296. X  
  297. X  
  298. X***************
  299. X*** 55,63 ****
  300. X  
  301. X  
  302. X  The Generic Linked List is in the public domain. It is available at our FTP
  303. X! archive (ftp.tno.nl or hermes.bouw.tno.nl), just retrieve te files :
  304. X!     /pub/TNO/BOUW/Bouwinf/linkedlist_0.8.README
  305. X!     /pub/TNO/BOUW/Bouwinf/linkedlist_0.8.shar
  306. X  
  307. X  
  308. X  If you have any comments, suggestions, or find any bugs, or make any changes
  309. X--- 60,68 ----
  310. X  
  311. X  
  312. X  The Generic Linked List is in the public domain. It is available at our FTP
  313. X! archive (ftp.tno.nl or hermes.bouw.tno.nl), just retrieve the files :
  314. X!     /pub/TNO/BOUW/Bouwinf/linkedlist_0.9.README
  315. X!     /pub/TNO/BOUW/Bouwinf/linkedlist_0.9.shar
  316. X  
  317. X  
  318. X  If you have any comments, suggestions, or find any bugs, or make any changes
  319. X***************
  320. X*** 69,72 ****
  321. X  P.O. Box 49
  322. X  2600 AA Delft
  323. X  The Netherlands
  324. X! FAX : +31 15 843990
  325. X--- 74,77 ----
  326. X  P.O. Box 49
  327. X  2600 AA Delft
  328. X  The Netherlands
  329. X! FAX : +31 15 122182
  330. X*** ../example.c    Fri Feb 26 09:04:13 1993
  331. X--- example.c    Fri May 21 09:58:14 1993
  332. X***************
  333. X*** 1,3 ****
  334. X--- 1,7 ----
  335. X+ #ifdef    AMIGA
  336. X+ #include        <string.h>
  337. X+ #endif
  338. X+ 
  339. X  #include        <stdio.h>
  340. X  #include        "list.h"
  341. X  
  342. X***************
  343. X*** 8,16 ****
  344. X  } Rapport;
  345. X  int    rapSz = sizeof(Rapport);
  346. X  
  347. X  static void    insRap(), prRapAll(), prRap();
  348. X! static int        search(), compare();
  349. X  
  350. X  main()
  351. X  {
  352. X      int            id, code, search_date;
  353. X--- 12,30 ----
  354. X  } Rapport;
  355. X  int    rapSz = sizeof(Rapport);
  356. X  
  357. X+ #ifdef ANSI
  358. X+ static void    insRap(int id, int where, int flag, char *title, char *author,
  359. X+                 int date);
  360. X+ static void    prRapAll(int id);
  361. X+ static void    prRap(int code, Rapport *rpprt);
  362. X+ static int    search(int *date, Rapport *rpprt);
  363. X+ static int    compare(Rapport *data1, Rapport *data2);
  364. X+ #else
  365. X  static void    insRap(), prRapAll(), prRap();
  366. X! static int    search(), compare();
  367. X! #endif
  368. X  
  369. X+ int
  370. X  main()
  371. X  {
  372. X      int            id, code, search_date;
  373. X***************
  374. X*** 82,89 ****
  375. X  
  376. X  static void
  377. X  insRap(id, where, flag, title, author, date)
  378. X! int    id, where, flag, date;
  379. X! char    *title, *author;
  380. X  {
  381. X      int        code;
  382. X      Rapport    rap;
  383. X--- 96,103 ----
  384. X  
  385. X  static void
  386. X  insRap(id, where, flag, title, author, date)
  387. X! int        id, where, flag, date;
  388. X! char        *title, *author;
  389. X  {
  390. X      int        code;
  391. X      Rapport    rap;
  392. X*** ../list.c    Mon May  3 11:08:59 1993
  393. X--- list.c    Wed May 19 16:38:34 1993
  394. X***************
  395. X*** 1,3 ****
  396. X--- 1,6 ----
  397. X+ #pragma option -ml -v -vi- -w-ret -w-nci -w-inl -wamp -w-par -w-cpt -w-dup -w-pia -w-ill -w-sus -wstv -w-ext -w-ias -w-ibc -w-pre -w-nst -A -G -O2 -w-sus -w-aus -w-par -w-pro -w-rvl
  398. X+ /* line at the top added for Borland or other MSDOS C compilers */
  399. X+ 
  400. X  /*
  401. X  **    Anita Eijs    TNO-BOUW, BouwInformatica    May 1989
  402. X  **
  403. X***************
  404. X*** 41,72 ****
  405. X  **    ***** Version 0.8, May 1993 *****
  406. X  */
  407. X  
  408. X! #ifdef MAC
  409. X! #define    MAC_OR_VAXC
  410. X  #endif
  411. X! #ifdef VAXC
  412. X! #define    MAC_OR_VAXC
  413. X! #define    MSDOS_OR_VAXC
  414. X  #endif
  415. X  #ifdef MSDOS
  416. X! #define    MSDOS_OR_VAXC
  417. X  #endif
  418. X  
  419. X  #ifdef MAC
  420. X  #include    <unix.h>    /* open, creat, write, read, close */
  421. X  #include    <stddef.h>    /* sizeof */
  422. X  #endif
  423. X  
  424. X! #ifdef MAC_OR_VAXC
  425. X  #include    <stdlib.h>
  426. X! #else
  427. X! #include    <malloc.h>
  428. X  #endif
  429. X  
  430. X- #ifdef MSDOS
  431. X- #include    <io.h>    /* open, creat, write, read, close */
  432. X- #endif
  433. X- 
  434. X  #include    <stdio.h>
  435. X  #include    "list.h"
  436. X  
  437. X--- 44,84 ----
  438. X  **    ***** Version 0.8, May 1993 *****
  439. X  */
  440. X  
  441. X! #ifdef __MSDOS__
  442. X! #define    MSDOS
  443. X! #define    ANSI
  444. X  #endif
  445. X! 
  446. X! #ifdef UNIX
  447. X! #include    <malloc.h>
  448. X  #endif
  449. X+ 
  450. X  #ifdef MSDOS
  451. X! #include    <malloc.h>
  452. X! #include    <io.h>        /* open, creat, write, read, close */
  453. X!     /* added for Borland or other MSDOS C compilers */
  454. X! #include    <stdlib.h>
  455. X! #include    <fcntl.h>
  456. X! #include    <sys\types.h>
  457. X! #include    <sys\stat.h>
  458. X! #include    <string.h>
  459. X  #endif
  460. X  
  461. X+ #ifdef VAXC
  462. X+ #include    <stdlib.h>
  463. X+ #endif
  464. X+ 
  465. X  #ifdef MAC
  466. X  #include    <unix.h>    /* open, creat, write, read, close */
  467. X  #include    <stddef.h>    /* sizeof */
  468. X+ #include    <stdlib.h>
  469. X  #endif
  470. X  
  471. X! #ifdef AMIGA
  472. X  #include    <stdlib.h>
  473. X! #include    <fcntl.h>    /* open, creat, write, read, close */
  474. X  #endif
  475. X  
  476. X  #include    <stdio.h>
  477. X  #include    "list.h"
  478. X  
  479. X***************
  480. X*** 98,106 ****
  481. X          while (i--) *to++ = *frm++; \
  482. X      }
  483. X  
  484. X! #define    BIN_WRITE    1    /* necessary for binary file access */
  485. X  #define    BIN_READ    0
  486. X  #define    PMODE        0666
  487. X  
  488. X  /* -------------------------------------------------------------------------- */
  489. X  
  490. X--- 110,125 ----
  491. X          while (i--) *to++ = *frm++; \
  492. X      }
  493. X  
  494. X!     /* necessary for binary file access */
  495. X! #ifdef MSDOS
  496. X! #define    BIN_WRITE    O_WRONLY|O_BINARY
  497. X! #define    BIN_READ    O_RDONLY|O_BINARY
  498. X! #define    PMODE        S_IREAD
  499. X! #else
  500. X! #define    BIN_WRITE    1
  501. X  #define    BIN_READ    0
  502. X  #define    PMODE        0666
  503. X+ #endif
  504. X  
  505. X  /* -------------------------------------------------------------------------- */
  506. X  
  507. X***************
  508. X*** 148,154 ****
  509. X  static void    lError(char *str, int code, int int1, int int2, char *str1);
  510. X  static int    setWhchNode(int id, int which, char *fname);
  511. X  static int    setIndxNode(int id, int index, char *fname);
  512. X! static int    partition(NodePtr *array, int order, Func func, int lb, int ub,
  513. X              int *pj);
  514. X  static int    stack_empty(int id);
  515. X  static int    intInSet(int intgr, int *set, int set_n);
  516. X--- 167,173 ----
  517. X  static void    lError(char *str, int code, int int1, int int2, char *str1);
  518. X  static int    setWhchNode(int id, int which, char *fname);
  519. X  static int    setIndxNode(int id, int index, char *fname);
  520. X! static void    partition(NodePtr *array, int order, Func func, int lb, int ub,
  521. X              int *pj);
  522. X  static int    stack_empty(int id);
  523. X  static int    intInSet(int intgr, int *set, int set_n);
  524. X***************
  525. X*** 159,165 ****
  526. X  static void    lError();
  527. X  static int    setWhchNode();
  528. X  static int    setIndxNode();
  529. X! static int    partition();
  530. X  static int    stack_empty();
  531. X  static int    intInSet();
  532. X  #endif
  533. X--- 178,184 ----
  534. X  static void    lError();
  535. X  static int    setWhchNode();
  536. X  static int    setIndxNode();
  537. X! static void    partition();
  538. X  static int    stack_empty();
  539. X  static int    intInSet();
  540. X  #endif
  541. X***************
  542. X*** 186,199 ****
  543. X  ** Return on error:
  544. X  **    lWRONG_SD, lWRONG_CC
  545. X  */
  546. X- #ifdef ANSI
  547. X  int
  548. X- lDef(int sd, int cc)
  549. X- #else
  550. X- int
  551. X  lDef(sd, cc)
  552. X  int    sd, cc;
  553. X- #endif
  554. X  {
  555. X      ListPtr        list, new;
  556. X      static int    set1[] = { lSINGLY, lDOUBLY },
  557. X--- 205,213 ----
  558. X***************
  559. X*** 245,258 ****
  560. X  ** Return on error:
  561. X  **    lUNKNOWN_ID
  562. X  */
  563. X- #ifdef ANSI
  564. X  int
  565. X- lInfo(int id, int *sd, int *cc, int *n)
  566. X- #else
  567. X- int
  568. X  lInfo(id, sd, cc, n)
  569. X  int    id, *sd, *cc, *n;
  570. X- #endif
  571. X  {
  572. X      ListPtr    list;
  573. X  
  574. X--- 259,267 ----
  575. X***************
  576. X*** 286,299 ****
  577. X  ** Return on error:
  578. X  **    lUNKNOWN_ID, lEMPTY_LIST, lWRONG_ORDER, lWRONG_THEORY
  579. X  */
  580. X- #ifdef ANSI
  581. X- int lSort(int id, int order, int theory, Func func)
  582. X- #else
  583. X  int
  584. X  lSort(id, order, theory, func)
  585. X  int    id, order, theory;
  586. X  Func    func;
  587. X- #endif
  588. X  {
  589. X      int        node_n, i, s, f, k, where, j, cmp;
  590. X      ListPtr        list;
  591. X--- 295,304 ----
  592. X***************
  593. X*** 320,331 ****
  594. X          return(lWRONG_THEORY);
  595. X      }
  596. X  
  597. X      node_n = list->n;
  598. X!         /* allocate 1 extra so I can nave a null in it */
  599. X      CALLOC(array, NodePtr, node_n+1);
  600. X  
  601. X      list->current = list->first;
  602. X!     for (i=0; i<node_n && list->current != NULL ; i++) {
  603. X          array[i] = list->current;
  604. X          list->current = (list->current)->nxt;
  605. X      }
  606. X--- 325,340 ----
  607. X          return(lWRONG_THEORY);
  608. X      }
  609. X  
  610. X+         /* one node is already sorted */
  611. X+     if (list->n == 1)
  612. X+         return(lSUCCESS);
  613. X+ 
  614. X      node_n = list->n;
  615. X!         /* allocate 1 extra so I can have a null in it */
  616. X      CALLOC(array, NodePtr, node_n+1);
  617. X  
  618. X      list->current = list->first;
  619. X!     for (i=0; i < node_n && list->current != NULL; i++) {
  620. X          array[i] = list->current;
  621. X          list->current = (list->current)->nxt;
  622. X      }
  623. X***************
  624. X*** 377,386 ****
  625. X                  s = -1;
  626. X              else
  627. X                  s = 1;
  628. X!             cmp = (*func)(array[2]->data, array[1]->data);
  629. X!             if (i > 2 && ((order == lASCENDING && cmp == l2LT1)
  630. X!              || (order == lDESCENDING && cmp == l1LT2)))
  631. X!                 s = 2;
  632. X  
  633. X              if (s >= 0)
  634. X                  cmp = (*func)(temp->data, array[s]->data);
  635. X--- 386,397 ----
  636. X                  s = -1;
  637. X              else
  638. X                  s = 1;
  639. X!             if (i > 2) {
  640. X!                 cmp = (*func)(array[2]->data, array[1]->data);
  641. X!                 if ((order == lASCENDING && cmp == l2LT1)
  642. X!                  || (order == lDESCENDING && cmp == l1LT2))
  643. X!                     s = 2;
  644. X!             }
  645. X  
  646. X              if (s >= 0)
  647. X                  cmp = (*func)(temp->data, array[s]->data);
  648. X***************
  649. X*** 393,399 ****
  650. X                  if (s+1 <= i-1) {
  651. X                      cmp = (*func)(array[s]->data,
  652. X                          array[s+1]->data);
  653. X!                     if (cmp < 0)
  654. X                          s = s+1;
  655. X                  }
  656. X                  if (s > i-1)
  657. X--- 404,413 ----
  658. X                  if (s+1 <= i-1) {
  659. X                      cmp = (*func)(array[s]->data,
  660. X                          array[s+1]->data);
  661. X!                     if ((order == lASCENDING
  662. X!                         && cmp == l1LT2) ||
  663. X!                      (order == lDESCENDING
  664. X!                         && cmp == l2LT1))
  665. X                          s = s+1;
  666. X                  }
  667. X                  if (s > i-1)
  668. X***************
  669. X*** 474,480 ****
  670. X      case lSELECTION: {
  671. X          int    indx;
  672. X  
  673. X!         for (i=node_n-1; i>0 ; i--) {
  674. X              temp = array[0];
  675. X              indx = 0;
  676. X  
  677. X--- 488,494 ----
  678. X      case lSELECTION: {
  679. X          int    indx;
  680. X  
  681. X!         for (i=node_n-1; i>0; i--) {
  682. X              temp = array[0];
  683. X              indx = 0;
  684. X  
  685. X***************
  686. X*** 557,571 ****
  687. X  **    header.n    number of <info>-<data>-combinations (nodes)
  688. X  **    info.size    size of <data>
  689. X  */
  690. X- #ifdef ANSI
  691. X  int
  692. X- lDump(int id, char *file)
  693. X- #else
  694. X- int
  695. X  lDump(id, file)
  696. X  int    id;
  697. X  char    *file;
  698. X- #endif
  699. X  {
  700. X  #ifndef MSDOS
  701. X      int    open(), creat(), write(), close();
  702. X--- 571,580 ----
  703. X***************
  704. X*** 622,639 ****
  705. X  ** Return on error:
  706. X  **    lOPEN_ERROR
  707. X  */
  708. X- #ifdef ANSI
  709. X  int
  710. X- lUndump(char *file)
  711. X- #else
  712. X- int
  713. X  lUndump(file)
  714. X  char    *file;
  715. X- #endif
  716. X  {
  717. X  #ifndef MSDOS
  718. X      int    open(), read(), close();
  719. X  #endif
  720. X  
  721. X      int    fdDump, i, id;
  722. X      Info    info;
  723. X--- 631,645 ----
  724. X  ** Return on error:
  725. X  **    lOPEN_ERROR
  726. X  */
  727. X  int
  728. X  lUndump(file)
  729. X  char    *file;
  730. X  {
  731. X  #ifndef MSDOS
  732. X+ #ifndef AMIGA
  733. X      int    open(), read(), close();
  734. X  #endif
  735. X+ #endif
  736. X  
  737. X      int    fdDump, i, id;
  738. X      Info    info;
  739. X***************
  740. X*** 674,687 ****
  741. X  ** Return on error:
  742. X  **    lUNKNOWN_ID
  743. X  */
  744. X- #ifdef ANSI
  745. X  int
  746. X- lDel(int id)
  747. X- #else
  748. X- int
  749. X  lDel(id)
  750. X  int    id;
  751. X- #endif
  752. X  {
  753. X      ListPtr    list;
  754. X  
  755. X--- 680,688 ----
  756. X***************
  757. X*** 710,722 ****
  758. X  ** Return on error:
  759. X  **    lNO_LIST
  760. X  */
  761. X- #ifdef ANSI
  762. X  int
  763. X- lDelAll(void)
  764. X- #else
  765. X- int
  766. X  lDelAll()
  767. X- #endif
  768. X  {
  769. X      ListPtr    list, nxt;
  770. X  
  771. X--- 711,718 ----
  772. X***************
  773. X*** 760,774 ****
  774. X  ** Return on error:
  775. X  **    lUNKNOWN_ID, lWRONG_WHERE
  776. X  */
  777. X- #ifdef ANSI
  778. X  int
  779. X- lInsNode(int id, int where, Byte *data, int size, int flag)
  780. X- #else
  781. X- int
  782. X  lInsNode(id, where, data, size, flag)
  783. X  int    id, where, size, flag;
  784. X  Byte    *data;
  785. X- #endif
  786. X  {
  787. X      ListPtr        list;
  788. X      NodePtr        node, new;
  789. X--- 756,765 ----
  790. X***************
  791. X*** 892,905 ****
  792. X  ** Return on error:
  793. X  **    lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lEOL, lNOT_DOUBLY
  794. X  */
  795. X- #ifdef ANSI
  796. X  int
  797. X- lInfoNode(int id, int which, int *size, int *flag)
  798. X- #else
  799. X- int
  800. X  lInfoNode(id, which, size, flag)
  801. X  int    id, which, *size, *flag;
  802. X- #endif
  803. X  {
  804. X      ListPtr    list;
  805. X      int    rtrn;
  806. X--- 883,891 ----
  807. X***************
  808. X*** 932,946 ****
  809. X  ** Return on error:
  810. X  **    lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lEOL, lNOT_DOUBLY, lSIZE_NE
  811. X  */
  812. X- #ifdef ANSI
  813. X  int
  814. X- lGetNode(int id, int which, Byte *data, int size)
  815. X- #else
  816. X- int
  817. X  lGetNode(id, which, data, size)
  818. X  int    id, which, size;
  819. X  Byte    *data;
  820. X- #endif
  821. X  {
  822. X      ListPtr    list;
  823. X      int    rtrn;
  824. X--- 918,927 ----
  825. X***************
  826. X*** 959,965 ****
  827. X  
  828. X      BYTE_COPY((list->current)->data, data, size);
  829. X  
  830. X!     if (list->current == list->first)
  831. X          return(lFIRST);
  832. X      else if (list->current == list->last)
  833. X          return(lLAST);
  834. X--- 940,953 ----
  835. X  
  836. X      BYTE_COPY((list->current)->data, data, size);
  837. X  
  838. X!     if (list->n == 1) {
  839. X!         if (which == lPREVIOUS || which == lLAST)
  840. X!             return(lFIRST);
  841. X!         else if (which == lNEXT || which == lFIRST)
  842. X!             return(lLAST);
  843. X!         else
  844. X!             return(lLAST);    /* which == lCURRENT */
  845. X!     } else if (list->current == list->first)
  846. X          return(lFIRST);
  847. X      else if (list->current == list->last)
  848. X          return(lLAST);
  849. X***************
  850. X*** 972,978 ****
  851. X  **
  852. X  ** Parameters:
  853. X  **    In    int    id    identifier of linked list
  854. X! **    In    int    where    from where must be searched
  855. X  **    In    Func    func    function for checking the data on conditions
  856. X  **    In    Byte    *ptr    data for comparison in function
  857. X  **    Out    Byte    *data    data of node
  858. X--- 960,967 ----
  859. X  **
  860. X  ** Parameters:
  861. X  **    In    int    id    identifier of linked list
  862. X! **    In    int    which    from which node must be searched and in which
  863. X! **                direction
  864. X  **    In    Func    func    function for checking the data on conditions
  865. X  **    In    Byte    *ptr    data for comparison in function
  866. X  **    Out    Byte    *data    data of node
  867. X***************
  868. X*** 981,998 ****
  869. X  ** Return on success:
  870. X  **    lFOUND, lFIRST, lLAST, lNOT_FOUND
  871. X  ** Return on error:
  872. X! **    lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHERE, lUNKNOWN_FUNC, lNOT_DOUBLY
  873. X  */
  874. X- #ifdef ANSI
  875. X  int
  876. X! lFndNode(int id, int where, Func func, Byte *ptr, Byte *data, int size)
  877. X! #else
  878. X! int
  879. X! lFndNode(id, where, func, ptr, data, size)
  880. X! int    id, where, size;
  881. X  Func    func;
  882. X  Byte    *ptr, *data;
  883. X- #endif
  884. X  {
  885. X      NodePtr        node;
  886. X      ListPtr        list;
  887. X--- 970,982 ----
  888. X  ** Return on success:
  889. X  **    lFOUND, lFIRST, lLAST, lNOT_FOUND
  890. X  ** Return on error:
  891. X! **    lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lUNKNOWN_FUNC, lNOT_DOUBLY
  892. X  */
  893. X  int
  894. X! lFndNode(id, which, func, ptr, data, size)
  895. X! int    id, which, size;
  896. X  Func    func;
  897. X  Byte    *ptr, *data;
  898. X  {
  899. X      NodePtr        node;
  900. X      ListPtr        list;
  901. X***************
  902. X*** 1008,1016 ****
  903. X          lError("lFndNode", lEMPTY_LIST, id, 0, NULL);
  904. X          return(lEMPTY_LIST);
  905. X      }
  906. X!     if (intInSet(where, set, 4) != 0) {
  907. X!         lError("lFndNode", lWRONG_WHERE, where, 0, NULL);
  908. X!         return(lWRONG_WHERE);
  909. X      }
  910. X      if (func == NULL) {
  911. X          lError("lFndNode", lUNKNOWN_FUNC, (int) func, 0, NULL);
  912. X--- 992,1000 ----
  913. X          lError("lFndNode", lEMPTY_LIST, id, 0, NULL);
  914. X          return(lEMPTY_LIST);
  915. X      }
  916. X!     if (intInSet(which, set, 4) != 0) {
  917. X!         lError("lFndNode", lWRONG_WHICH, which, 0, NULL);
  918. X!         return(lWRONG_WHICH);
  919. X      }
  920. X      if (func == NULL) {
  921. X          lError("lFndNode", lUNKNOWN_FUNC, (int) func, 0, NULL);
  922. X***************
  923. X*** 1017,1024 ****
  924. X          return(lUNKNOWN_FUNC);
  925. X      }
  926. X  
  927. X!         /* set node for where searching must start */
  928. X!     switch (where) {
  929. X      case lFIRST:    node = list->first;    break;
  930. X      case lNEXT:
  931. X      case lPREVIOUS:    node = list->current;    break;
  932. X--- 1001,1008 ----
  933. X          return(lUNKNOWN_FUNC);
  934. X      }
  935. X  
  936. X!         /* set node where searching must start */
  937. X!     switch (which) {
  938. X      case lFIRST:    node = list->first;    break;
  939. X      case lNEXT:
  940. X      case lPREVIOUS:    node = list->current;    break;
  941. X***************
  942. X*** 1026,1037 ****
  943. X      }
  944. X  
  945. X          /* expected data and node must have same size */
  946. X!     if ((where == lFIRST || where == lLAST) && node->size == size) {
  947. X          BYTE_COPY(node->data, data, size);
  948. X          cmp = (*func)(ptr, data);
  949. X      }
  950. X  
  951. X!     switch (where) {
  952. X      case lFIRST:    /* search forward */
  953. X      case lNEXT:
  954. X          while (cmp != lFOUND && node->nxt != NULL
  955. X--- 1010,1021 ----
  956. X      }
  957. X  
  958. X          /* expected data and node must have same size */
  959. X!     if ((which == lFIRST || which == lLAST) && node->size == size) {
  960. X          BYTE_COPY(node->data, data, size);
  961. X          cmp = (*func)(ptr, data);
  962. X      }
  963. X  
  964. X!     switch (which) {
  965. X      case lFIRST:    /* search forward */
  966. X      case lNEXT:
  967. X          while (cmp != lFOUND && node->nxt != NULL
  968. X***************
  969. X*** 1080,1085 ****
  970. X--- 1064,1071 ----
  971. X  **
  972. X  ** Parameters:
  973. X  **    In    int    id    identifier of linked list
  974. X+ **    In    int    which    from which node must be searched and in which
  975. X+ **                direction
  976. X  **    In    int    flag    flag of node which must be retrieved
  977. X  **    Out    Byte    *data    data of node
  978. X  **    In    int    size    size of data
  979. X***************
  980. X*** 1087,1103 ****
  981. X  ** Return on success:
  982. X  **    lFOUND, lFIRST, lLAST, lNOT_FOUND
  983. X  ** Return on error:
  984. X! **    lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHERE, lSIZE_NE
  985. X  */
  986. X- #ifdef ANSI
  987. X  int
  988. X! lFndFlagNode(int id, int where, int flag, Byte *data, int size)
  989. X! #else
  990. X! int
  991. X! lFndFlagNode(id, where, flag, data, size)
  992. X! int    id, where, flag, size;
  993. X  Byte    *data;
  994. X- #endif
  995. X  {
  996. X      NodePtr        node;
  997. X      ListPtr        list;
  998. X--- 1073,1084 ----
  999. X  ** Return on success:
  1000. X  **    lFOUND, lFIRST, lLAST, lNOT_FOUND
  1001. X  ** Return on error:
  1002. X! **    lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lSIZE_NE
  1003. X  */
  1004. X  int
  1005. X! lFndFlagNode(id, which, flag, data, size)
  1006. X! int    id, which, flag, size;
  1007. X  Byte    *data;
  1008. X  {
  1009. X      NodePtr        node;
  1010. X      ListPtr        list;
  1011. X***************
  1012. X*** 1112,1124 ****
  1013. X          lError("lFndFlagNode", lEMPTY_LIST, id, 0, NULL);
  1014. X          return(lEMPTY_LIST);
  1015. X      }
  1016. X!     if (intInSet(where, set, 4) != 0) {
  1017. X!         lError("lFndFlagNode", lWRONG_WHERE, where, 0, NULL);
  1018. X!         return(lWRONG_WHERE);
  1019. X      }
  1020. X  
  1021. X!         /* set node for where searching must start */
  1022. X!     switch (where) {
  1023. X      case lFIRST:
  1024. X          node = list->first;
  1025. X          break;
  1026. X--- 1093,1105 ----
  1027. X          lError("lFndFlagNode", lEMPTY_LIST, id, 0, NULL);
  1028. X          return(lEMPTY_LIST);
  1029. X      }
  1030. X!     if (intInSet(which, set, 4) != 0) {
  1031. X!         lError("lFndFlagNode", lWRONG_WHICH, which, 0, NULL);
  1032. X!         return(lWRONG_WHICH);
  1033. X      }
  1034. X  
  1035. X!         /* set node where searching must start */
  1036. X!     switch (which) {
  1037. X      case lFIRST:
  1038. X          node = list->first;
  1039. X          break;
  1040. X***************
  1041. X*** 1138,1144 ****
  1042. X      }
  1043. X  
  1044. X          /* search till begin/end of list */
  1045. X!     switch (where) {
  1046. X      case lFIRST:    /* search forward */
  1047. X      case lNEXT:
  1048. X          while (node->flag != flag && node != list->last)
  1049. X--- 1119,1125 ----
  1050. X      }
  1051. X  
  1052. X          /* search till begin/end of list */
  1053. X!     switch (which) {
  1054. X      case lFIRST:    /* search forward */
  1055. X      case lNEXT:
  1056. X          while (node->flag != flag && node != list->last)
  1057. X***************
  1058. X*** 1172,1178 ****
  1059. X  
  1060. X      BYTE_COPY((list->current)->data, data, size);
  1061. X  
  1062. X!     if (list->current == list->first)
  1063. X          return(lFIRST);
  1064. X      else if (list->current == list->last)
  1065. X          return(lLAST);
  1066. X--- 1153,1166 ----
  1067. X  
  1068. X      BYTE_COPY((list->current)->data, data, size);
  1069. X  
  1070. X!     if (list->n == 1) {
  1071. X!         if (which == lPREVIOUS || which == lLAST)
  1072. X!             return(lFIRST);
  1073. X!         else if (which == lNEXT || which == lFIRST)
  1074. X!             return(lLAST);
  1075. X!         else
  1076. X!             return(lLAST);    /* which == lCURRENT */
  1077. X!     } else if (list->current == list->first)
  1078. X          return(lFIRST);
  1079. X      else if (list->current == list->last)
  1080. X          return(lLAST);
  1081. X***************
  1082. X*** 1181,1187 ****
  1083. X  }
  1084. X  
  1085. X  /*******************************************************************************
  1086. X! ** Update curent node.
  1087. X  **
  1088. X  ** Parameters:
  1089. X  **    In    int    id    identifier of linked list
  1090. X--- 1169,1175 ----
  1091. X  }
  1092. X  
  1093. X  /*******************************************************************************
  1094. X! ** Update current node.
  1095. X  **
  1096. X  ** Parameters:
  1097. X  **    In    int    id    identifier of linked list
  1098. X***************
  1099. X*** 1194,1208 ****
  1100. X  ** Return on error:
  1101. X  **    lUNKNOWN_ID, lEMPTY_LIST
  1102. X  */
  1103. X- #ifdef ANSI
  1104. X  int
  1105. X- lUpdNode(int id, Byte *data, int size, int flag)
  1106. X- #else
  1107. X- int
  1108. X  lUpdNode(id, data, size, flag)
  1109. X  int    id, size, flag;
  1110. X  Byte    *data;
  1111. X- #endif
  1112. X  {
  1113. X      ListPtr    list;
  1114. X  
  1115. X--- 1182,1191 ----
  1116. X***************
  1117. X*** 1242,1255 ****
  1118. X  ** Return on error:
  1119. X  **    lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH
  1120. X  */
  1121. X- #ifdef ANSI
  1122. X  int
  1123. X- lDelNode(int id, int which)
  1124. X- #else
  1125. X- int
  1126. X  lDelNode(id, which)
  1127. X  int    id, which;
  1128. X- #endif
  1129. X  {
  1130. X      NodePtr        node, prv, nxt;
  1131. X      ListPtr        list;
  1132. X--- 1225,1233 ----
  1133. X***************
  1134. X*** 1355,1368 ****
  1135. X  ** Return on error:
  1136. X  **    lUNKNOWN_ID, lEMPTY_LIST, lWRONG_INDEX
  1137. X  */
  1138. X- #ifdef ANSI
  1139. X  int
  1140. X- lInfoIndxNode(int id, int index, int *size, int *flag)
  1141. X- #else
  1142. X- int
  1143. X  lInfoIndxNode(id, index, size, flag)
  1144. X  int    id, index, *size, *flag;
  1145. X- #endif
  1146. X  {
  1147. X      ListPtr    list;
  1148. X      int    rtrn;
  1149. X--- 1333,1341 ----
  1150. X***************
  1151. X*** 1394,1408 ****
  1152. X  ** Return on error:
  1153. X  **    lUNKNOWN_ID, lEMPTY_LIST, lWRONG_INDEX, lSIZE_NE
  1154. X  */
  1155. X- #ifdef ANSI
  1156. X  int
  1157. X- lGetIndxNode(int id, int index, Byte *data, int size)
  1158. X- #else
  1159. X- int
  1160. X  lGetIndxNode(id, index, data, size)
  1161. X  int    id, index, size;
  1162. X  Byte    *data;
  1163. X- #endif
  1164. X  {
  1165. X      ListPtr    list;
  1166. X      int    rtrn;
  1167. X--- 1367,1376 ----
  1168. X***************
  1169. X*** 1422,1428 ****
  1170. X  
  1171. X      BYTE_COPY((list->current)->data, data, size);
  1172. X  
  1173. X!     if (list->current == list->first)
  1174. X          return(lFIRST);
  1175. X      else if (list->current == list->last)
  1176. X          return(lLAST);
  1177. X--- 1390,1398 ----
  1178. X  
  1179. X      BYTE_COPY((list->current)->data, data, size);
  1180. X  
  1181. X!     if (list->n == 1)
  1182. X!         return(lLAST);
  1183. X!     else if (list->current == list->first)
  1184. X          return(lFIRST);
  1185. X      else if (list->current == list->last)
  1186. X          return(lLAST);
  1187. X***************
  1188. X*** 1445,1459 ****
  1189. X  ** Return on error:
  1190. X  **    lUNKNOWN_ID, lEMPTY_LIST, lWRONG_INDEX
  1191. X  */
  1192. X- #ifdef ANSI
  1193. X  int
  1194. X- lUpdIndxNode(int id, int index, Byte *data, int size, int flag)
  1195. X- #else
  1196. X- int
  1197. X  lUpdIndxNode(id, index, data, size, flag)
  1198. X  int    id, index, size, flag;
  1199. X  Byte    *data;
  1200. X- #endif
  1201. X  {
  1202. X      ListPtr    list;
  1203. X      int    rtrn;
  1204. X--- 1415,1424 ----
  1205. X***************
  1206. X*** 1489,1502 ****
  1207. X  ** Return on error:
  1208. X  **    lUNKNOWN_ID, lEMPTY_LIST, lWRONG_INDEX
  1209. X  */
  1210. X- #ifdef ANSI
  1211. X  int
  1212. X- lDelIndxNode(int id, int index)
  1213. X- #else
  1214. X- int
  1215. X  lDelIndxNode(id, index)
  1216. X  int    id, index;
  1217. X- #endif
  1218. X  {
  1219. X      int    rtrn;
  1220. X  
  1221. X--- 1454,1462 ----
  1222. X***************
  1223. X*** 1510,1523 ****
  1224. X  /* ---------- static local functions ---------------------------------------- */
  1225. X  
  1226. X  /* get address of list data */
  1227. X- #ifdef ANSI
  1228. X  static ListPtr
  1229. X- getAddress(int id)
  1230. X- #else
  1231. X- static ListPtr
  1232. X  getAddress(id)
  1233. X  int    id;
  1234. X- #endif
  1235. X  {
  1236. X      ListPtr    list;
  1237. X  
  1238. X--- 1470,1478 ----
  1239. X***************
  1240. X*** 1535,1549 ****
  1241. X  }
  1242. X  
  1243. X  /* delete nodes of a linked list */
  1244. X- #ifdef ANSI
  1245. X  static void
  1246. X- delNodes(NodePtr node, int n)
  1247. X- #else
  1248. X- static void
  1249. X  delNodes(node, n)
  1250. X  NodePtr    node;
  1251. X  int    n;
  1252. X- #endif
  1253. X  {
  1254. X      NodePtr    nxt;
  1255. X      int    i;
  1256. X--- 1490,1499 ----
  1257. X***************
  1258. X*** 1557,1570 ****
  1259. X  }
  1260. X  
  1261. X  /* delete info about linked list */
  1262. X- #ifdef ANSI
  1263. X  static void
  1264. X- delListInfo(ListPtr list)
  1265. X- #else
  1266. X- static void
  1267. X  delListInfo(list)
  1268. X  ListPtr    list;
  1269. X- #endif
  1270. X  {
  1271. X      ListPtr    nxt;
  1272. X  
  1273. X--- 1507,1515 ----
  1274. X***************
  1275. X*** 1576,1592 ****
  1276. X  }
  1277. X  
  1278. X  /* print error message in lERROR_FILE */
  1279. X- #ifdef ANSI
  1280. X  static void
  1281. X- lError(char *str, int code, int int1, int int2, char *str1)
  1282. X- #else
  1283. X- static void
  1284. X  lError(str, code, int1, int2, str1)
  1285. X  char    *str, *str1;
  1286. X  int    code, int1, int2;
  1287. X- #endif
  1288. X  {
  1289. X- #ifndef MSDOS
  1290. X      char    mess[60];
  1291. X      FILE    *fpError, *fopen();
  1292. X  
  1293. X--- 1521,1531 ----
  1294. X***************
  1295. X*** 1660,1680 ****
  1296. X          fprintf(stderr, "Can't open error-file '%s'\n", lERROR_FILE);
  1297. X          fprintf(stderr, "Error, '%s': %s\n", str, mess);
  1298. X      } else {
  1299. X!         fprintf(fpError, "Error, '%s': %s\n", str, mess);
  1300. X          fclose(fpError);
  1301. X      }
  1302. X- #endif
  1303. X  }
  1304. X  
  1305. X- #ifdef ANSI
  1306. X  static int
  1307. X- setWhchNode(int id, int which, char *fname)
  1308. X- #else
  1309. X- static int
  1310. X  setWhchNode(id, which, fname)
  1311. X  int    id, which;
  1312. X  char    *fname;
  1313. X- #endif
  1314. X  {
  1315. X      ListPtr        list;
  1316. X      static int    set[] = { lFIRST, lNEXT, lCURRENT, lPREVIOUS, lLAST };
  1317. X--- 1599,1613 ----
  1318. X          fprintf(stderr, "Can't open error-file '%s'\n", lERROR_FILE);
  1319. X          fprintf(stderr, "Error, '%s': %s\n", str, mess);
  1320. X      } else {
  1321. X!         fprintf(fpError, "Error in '%s': %s\n", str, mess);
  1322. X          fclose(fpError);
  1323. X      }
  1324. X  }
  1325. X  
  1326. X  static int
  1327. X  setWhchNode(id, which, fname)
  1328. X  int    id, which;
  1329. X  char    *fname;
  1330. X  {
  1331. X      ListPtr        list;
  1332. X      static int    set[] = { lFIRST, lNEXT, lCURRENT, lPREVIOUS, lLAST };
  1333. X***************
  1334. X*** 1726,1740 ****
  1335. X      return(lSUCCESS);
  1336. X  }
  1337. X  
  1338. X- #ifdef ANSI
  1339. X  static int
  1340. X- setIndxNode(int id, int index, char *fname)
  1341. X- #else
  1342. X- static int
  1343. X  setIndxNode(id, index, fname)
  1344. X  int    id, index;
  1345. X  char    *fname;
  1346. X- #endif
  1347. X  {
  1348. X      ListPtr    list;
  1349. X      int    i;
  1350. X--- 1659,1668 ----
  1351. X***************
  1352. X*** 1767,1782 ****
  1353. X  }
  1354. X  
  1355. X  /* local function for QUICK sort */
  1356. X! #ifdef ANSI
  1357. X! static int
  1358. X! partition(NodePtr *array, int order, Func func, int lb, int ub, int *pj)
  1359. X! #else
  1360. X! static int
  1361. X  partition(array, order, func, lb, ub, pj)
  1362. X  NodePtr    *array;
  1363. X  int    order, lb, ub, *pj;
  1364. X  Func    func;
  1365. X- #endif
  1366. X  {
  1367. X      int    down, up, cmp;
  1368. X      NodePtr    temp, a;
  1369. X--- 1695,1705 ----
  1370. X  }
  1371. X  
  1372. X  /* local function for QUICK sort */
  1373. X! static void
  1374. X  partition(array, order, func, lb, ub, pj)
  1375. X  NodePtr    *array;
  1376. X  int    order, lb, ub, *pj;
  1377. X  Func    func;
  1378. X  {
  1379. X      int    down, up, cmp;
  1380. X      NodePtr    temp, a;
  1381. X***************
  1382. X*** 1812,1825 ****
  1383. X  }
  1384. X  
  1385. X  /* local function for QUICK sort */
  1386. X- #ifdef ANSI
  1387. X  static int
  1388. X- stack_empty(int id)
  1389. X- #else
  1390. X- static int
  1391. X  stack_empty(id)
  1392. X  int    id;
  1393. X- #endif
  1394. X  {
  1395. X      int    sd, cc, n;
  1396. X  
  1397. X--- 1735,1743 ----
  1398. X*** ../list.h    Tue Apr 20 11:06:14 1993
  1399. X--- list.h    Wed May 19 10:08:47 1993
  1400. X***************
  1401. X*** 50,59 ****
  1402. X  
  1403. X  #define    lFOUND        0    /* node found */
  1404. X  
  1405. X! #ifdef MSDOS_OR_VAXC
  1406. X  #define    lERROR_FILE    "linklist.err"
  1407. X  #else
  1408. X  #define    lERROR_FILE    "=listError="
  1409. X  #endif
  1410. X  
  1411. X  #ifdef ANSI
  1412. X--- 50,63 ----
  1413. X  
  1414. X  #define    lFOUND        0    /* node found */
  1415. X  
  1416. X! #ifdef MSDOS
  1417. X  #define    lERROR_FILE    "linklist.err"
  1418. X  #else
  1419. X+ # ifdef VAXC
  1420. X+ #define    lERROR_FILE    "linklist.err"
  1421. X+ # else
  1422. X  #define    lERROR_FILE    "=listError="
  1423. X+ # endif
  1424. X  #endif
  1425. X  
  1426. X  #ifdef ANSI
  1427. X*** ../sorted.c    Fri Feb 26 11:25:09 1993
  1428. X--- sorted.c    Wed May 19 14:09:36 1993
  1429. X***************
  1430. X*** 2,10 ****
  1431. X  #include    <string.h>
  1432. X  #include    "list.h"
  1433. X  
  1434. X- static void    addPersonSorted(), addPerson();
  1435. X- static int    fndNxtPerson(), sortPerson(), compare();
  1436. X- 
  1437. X  typedef struct person {
  1438. X      char    lastname[15];
  1439. X      char    firstname[15];
  1440. X--- 2,7 ----
  1441. X***************
  1442. X*** 11,16 ****
  1443. X--- 8,25 ----
  1444. X  } Person, *PersonPtr;
  1445. X  int    personSz = sizeof(Person);
  1446. X  
  1447. X+ #ifdef ANSI
  1448. X+ static void    addPerson(int id, char *first, char *last);
  1449. X+ static void    addPersonSorted(int id, char *first, char *last);
  1450. X+ static int    compare(PersonPtr p1, PersonPtr p2, int order);
  1451. X+ static int    fndNxtPerson(char *last, PersonPtr data);
  1452. X+ static int    sortPerson(int id);
  1453. X+ #else
  1454. X+ static void    addPerson(), addPersonSorted();
  1455. X+ static int    compare(), fndNxtPerson(), sortPerson();
  1456. X+ #endif
  1457. X+ 
  1458. X+ int
  1459. X  main()
  1460. X  {
  1461. X      Person    person;
  1462. X*** ../sorttest.c    Mon May  3 11:45:21 1993
  1463. X--- sorttest.c    Wed May 19 14:37:07 1993
  1464. X***************
  1465. X*** 1,9 ****
  1466. X  /* Sort torture test */
  1467. X  
  1468. X  #include    <stdio.h>
  1469. X  #include    <string.h>
  1470. X  #include    "list.h"
  1471. X- #include    "time.h"
  1472. X  
  1473. X  typedef struct catalog {
  1474. X      char        number[35];
  1475. X--- 1,21 ----
  1476. X  /* Sort torture test */
  1477. X  
  1478. X+ #ifdef UNIX
  1479. X+ #include    <malloc.h>
  1480. X+ #endif
  1481. X+ 
  1482. X+ #ifdef    AMIGA
  1483. X+ #include    <stdlib.h>
  1484. X+ #endif
  1485. X+ 
  1486. X+ #ifdef MSDOS
  1487. X+ #include    <malloc.h>
  1488. X+ #endif
  1489. X+ 
  1490. X  #include    <stdio.h>
  1491. X  #include    <string.h>
  1492. X+ #include    <time.h>
  1493. X  #include    "list.h"
  1494. X  
  1495. X  typedef struct catalog {
  1496. X      char        number[35];
  1497. X***************
  1498. X*** 12,32 ****
  1499. X      int        date;
  1500. X  } catalog;
  1501. X  
  1502. X  static int    compare_author();
  1503. X  static int    compare_title();
  1504. X  static void    load_it();
  1505. X  static void    print_some();
  1506. X  static time_t    what_time();
  1507. X  static void    prRap();
  1508. X  
  1509. X- #ifdef ANSI
  1510. X  static int
  1511. X- compare_author(catalog *a, catalog *b)
  1512. X- #else
  1513. X- static int
  1514. X  compare_author(a, b)
  1515. X  catalog *a, *b;
  1516. X- #endif
  1517. X  {
  1518. X      int    k;
  1519. X  
  1520. X--- 24,50 ----
  1521. X      int        date;
  1522. X  } catalog;
  1523. X  
  1524. X+ #ifdef ANSI
  1525. X+ static int    compare_author(catalog *a, catalog *b);
  1526. X+ static int    compare_title(catalog *a, catalog *b, int order);
  1527. X+ static void    load_it(int id, int num);
  1528. X+ static void    print_some(int id, int num);
  1529. X+ static time_t    what_time(void);
  1530. X+ static void    diff_time(time_t a, time_t b);
  1531. X+ static void    prRap(int code, catalog *rpprt);
  1532. X+ #else
  1533. X  static int    compare_author();
  1534. X  static int    compare_title();
  1535. X  static void    load_it();
  1536. X  static void    print_some();
  1537. X  static time_t    what_time();
  1538. X+ static void    diff_time();
  1539. X  static void    prRap();
  1540. X+ #endif
  1541. X  
  1542. X  static int
  1543. X  compare_author(a, b)
  1544. X  catalog *a, *b;
  1545. X  {
  1546. X      int    k;
  1547. X  
  1548. X***************
  1549. X*** 40,54 ****
  1550. X          return(l1LT2);
  1551. X  }
  1552. X  
  1553. X- #ifdef ANSI
  1554. X  static int
  1555. X- compare_title(catalog *a, catalog *b, int order)
  1556. X- #else
  1557. X- static int
  1558. X  compare_title(a, b, order)
  1559. X  catalog *a, *b;
  1560. X  int order;
  1561. X- #endif
  1562. X  {
  1563. X      int    k;
  1564. X  
  1565. X--- 58,67 ----
  1566. X***************
  1567. X*** 62,76 ****
  1568. X          return(l1LT2);
  1569. X  }
  1570. X  
  1571. X- #ifdef ANSI
  1572. X  static void
  1573. X- load_it(int id, int num)
  1574. X- #else
  1575. X- static void
  1576. X  load_it(id, num)
  1577. X  int id;
  1578. X  int num;
  1579. X- #endif
  1580. X  {
  1581. X      int    loop, size = sizeof(catalog), code;
  1582. X      char    c1, c2, c3, c4, c5, c6, c7, c8;
  1583. X--- 75,84 ----
  1584. X***************
  1585. X*** 99,113 ****
  1586. X      /* printf("Linked List created\n"); */
  1587. X  }
  1588. X  
  1589. X- #ifdef ANSI
  1590. X  static void
  1591. X- print_some(int id, int num)
  1592. X- #else
  1593. X- static void
  1594. X  print_some(id, num)
  1595. X  int id;
  1596. X  int num;
  1597. X- #endif
  1598. X  {
  1599. X      int    size = sizeof(catalog), loop;
  1600. X      int    code;
  1601. X--- 107,116 ----
  1602. X***************
  1603. X*** 122,142 ****
  1604. X      }
  1605. X  }
  1606. X  
  1607. X! #ifdef ANSI
  1608. X! static time_t what_time(void)
  1609. X! #else
  1610. X! static time_t what_time()
  1611. X! #endif
  1612. X  {
  1613. X      return((time_t)time(NULL));
  1614. X  }
  1615. X  
  1616. X! #ifdef ANSI
  1617. X! static void diff_time(time_t a, time_t b)
  1618. X! #else
  1619. X! static void diff_time(a, b)
  1620. X  time_t a, b;
  1621. X- #endif
  1622. X  {
  1623. X      struct tm    *tt;
  1624. X      char        buf1[101], buf2[101];
  1625. X--- 125,139 ----
  1626. X      }
  1627. X  }
  1628. X  
  1629. X! static time_t
  1630. X! what_time()
  1631. X  {
  1632. X      return((time_t)time(NULL));
  1633. X  }
  1634. X  
  1635. X! static void
  1636. X! diff_time(a, b)
  1637. X  time_t a, b;
  1638. X  {
  1639. X      struct tm    *tt;
  1640. X      char        buf1[101], buf2[101];
  1641. X***************
  1642. X*** 160,165 ****
  1643. X--- 157,163 ----
  1644. X      (sec[1] - sec[0] > 0)?(sec[1] - sec[0]) : (sec[0] - sec[1]));
  1645. X  }
  1646. X  
  1647. X+ int
  1648. X  main()
  1649. X  {
  1650. X      int    size = sizeof(catalog);
  1651. X***************
  1652. X*** 175,181 ****
  1653. X      printf("Untouched list\n");
  1654. X      print_some(id, 10);
  1655. X  
  1656. X!     printf("-- lQuickSort --\nlQuickSort DESCENDING by TITLE : ");
  1657. X      start = what_time();
  1658. X      code = lSort(id, lDESCENDING, lQUICK, compare_title);
  1659. X      finish = what_time();
  1660. X--- 173,179 ----
  1661. X      printf("Untouched list\n");
  1662. X      print_some(id, 10);
  1663. X  
  1664. X!     printf("lQuickSort DESCENDING by TITLE : ");
  1665. X      start = what_time();
  1666. X      code = lSort(id, lDESCENDING, lQUICK, compare_title);
  1667. X      finish = what_time();
  1668. X***************
  1669. X*** 213,219 ****
  1670. X      printf("Untouched list\n");
  1671. X      print_some(id, 10);
  1672. X  
  1673. X!     printf(" -- lHeapSort -- \nlHeapSort DESCENDING by TITLE : ");
  1674. X      start = what_time();
  1675. X      code = lSort(id, lDESCENDING, lHEAP, compare_title);
  1676. X      finish = what_time();
  1677. X--- 211,217 ----
  1678. X      printf("Untouched list\n");
  1679. X      print_some(id, 10);
  1680. X  
  1681. X!     printf("lHeapSort DESCENDING by TITLE : ");
  1682. X      start = what_time();
  1683. X      code = lSort(id, lDESCENDING, lHEAP, compare_title);
  1684. X      finish = what_time();
  1685. X***************
  1686. X*** 332,343 ****
  1687. X  
  1688. X  static void
  1689. X  prRap(code, rpprt)
  1690. X! int            code;
  1691. X! catalog        *rpprt;
  1692. X  {
  1693. X      if (code >= 0)
  1694. X!         printf("catalog :'%s' '%s' '%s' '%d'\n", rpprt->number, rpprt->title,
  1695. X!             rpprt->author, rpprt->date);
  1696. X      else
  1697. X          printf("Return code = %d\n", code);
  1698. X  }
  1699. X--- 330,341 ----
  1700. X  
  1701. X  static void
  1702. X  prRap(code, rpprt)
  1703. X! int    code;
  1704. X! catalog    *rpprt;
  1705. X  {
  1706. X      if (code >= 0)
  1707. X!         printf("catalog :'%s'\t'%s'\t'%s'\t'%d'\n", rpprt->number,
  1708. X!             rpprt->title, rpprt->author, rpprt->date);
  1709. X      else
  1710. X          printf("Return code = %d\n", code);
  1711. X  }
  1712. X*** ../Doc/Intro.3    Fri Feb 26 10:56:12 1993
  1713. X--- Doc/Intro.3    Thu May 27 12:01:52 1993
  1714. X***************
  1715. X*** 1,4 ****
  1716. X- '.so tmac.clman
  1717. X  .TH "Intro"
  1718. X  .IX Intro
  1719. X  .SH NAME
  1720. X--- 1,3 ----
  1721. X***************
  1722. X*** 78,83 ****
  1723. X--- 77,86 ----
  1724. X  .SH EXAMPLE
  1725. X  .if t .ta 0.3i 0.6i 0.9i 1.2i 2.2i 3.2i 4.2i 4.5i 4.8i
  1726. X  .nf
  1727. X+ #ifdef    AMIGA
  1728. X+ #include        <string.h>
  1729. X+ #endif
  1730. X+ 
  1731. X  #include        <stdio.h>
  1732. X  #include        "list.h"
  1733. X  
  1734. X***************
  1735. X*** 88,96 ****
  1736. X  } Rapport;
  1737. X  int    rapSz = sizeof(Rapport);
  1738. X  
  1739. X  static void    insRap(), prRapAll(), prRap();
  1740. X! static int        search(), compare();
  1741. X  
  1742. X  main()
  1743. X  {
  1744. X      int            id, code, search_date;
  1745. X--- 91,109 ----
  1746. X  } Rapport;
  1747. X  int    rapSz = sizeof(Rapport);
  1748. X  
  1749. X+ #ifdef ANSI
  1750. X+ static void    insRap(int id, int where, int flag, char *title, char *author,
  1751. X+                 int date);
  1752. X+ static void    prRapAll(int id);
  1753. X+ static void    prRap(int code, Rapport *rpprt);
  1754. X+ static int    search(int *date, Rapport *rpprt);
  1755. X+ static int    compare(Rapport *data1, Rapport *data2);
  1756. X+ #else
  1757. X  static void    insRap(), prRapAll(), prRap();
  1758. X! static int    search(), compare();
  1759. X! #endif
  1760. X  
  1761. X+ int
  1762. X  main()
  1763. X  {
  1764. X      int            id, code, search_date;
  1765. X***************
  1766. X*** 102,111 ****
  1767. X      insRap(id, lFIRST, 2, "Book 2", "More People", 890130);
  1768. X      insRap(id, lLAST, 1, "Book 3", "Lots of People", 890131);
  1769. X  
  1770. X!     fprintf(stdout, "lGetNode\n");
  1771. X      prRapAll(id);
  1772. X  
  1773. X!     fprintf(stdout, "lGetIndxNode\n");
  1774. X      code = lGetIndxNode(id, 4, &rap, rapSz);
  1775. X      prRap(code, &rap);
  1776. X      code = lGetIndxNode(id, 2, &rap, rapSz);
  1777. X--- 115,124 ----
  1778. X      insRap(id, lFIRST, 2, "Book 2", "More People", 890130);
  1779. X      insRap(id, lLAST, 1, "Book 3", "Lots of People", 890131);
  1780. X  
  1781. X!     fprintf(stdout, "lGetNode\\n");
  1782. X      prRapAll(id);
  1783. X  
  1784. X!     fprintf(stdout, "lGetIndxNode\\n");
  1785. X      code = lGetIndxNode(id, 4, &rap, rapSz);
  1786. X      prRap(code, &rap);
  1787. X      code = lGetIndxNode(id, 2, &rap, rapSz);
  1788. X***************
  1789. X*** 115,121 ****
  1790. X      code = lGetIndxNode(id, 3, &rap, rapSz);
  1791. X      prRap(code, &rap);
  1792. X  
  1793. X!     fprintf(stdout, "lFndNode\n");
  1794. X      search_date = 890129;
  1795. X      code = lFndNode(id, lFIRST, search, &search_date, &rap, rapSz);
  1796. X      prRap(code, &rap);
  1797. X--- 128,134 ----
  1798. X      code = lGetIndxNode(id, 3, &rap, rapSz);
  1799. X      prRap(code, &rap);
  1800. X  
  1801. X!     fprintf(stdout, "lFndNode\\n");
  1802. X      search_date = 890129;
  1803. X      code = lFndNode(id, lFIRST, search, &search_date, &rap, rapSz);
  1804. X      prRap(code, &rap);
  1805. X***************
  1806. X*** 125,142 ****
  1807. X      prRap(code, &rap);
  1808. X  
  1809. X      code = lDump(id, "dump");
  1810. X!     fprintf(stdout, "lDump : %d\n", code);
  1811. X  
  1812. X      lDel(id);
  1813. X  
  1814. X      id = lUndump("dump");
  1815. X!     fprintf(stdout, "lUndump : %d\n", id);
  1816. X  
  1817. X      insRap(id, lFIRST, 4, "Book 4", "The Author", 891127);
  1818. X  
  1819. X      prRapAll(id);
  1820. X  
  1821. X!     fprintf(stdout, "lFndFlagNode\n");
  1822. X      code = lFndFlagNode(id, lFIRST, 1, &rap, rapSz);
  1823. X      prRap(code, &rap);
  1824. X      code = lFndFlagNode(id, lNEXT, 1, &rap, rapSz);
  1825. X--- 138,155 ----
  1826. X      prRap(code, &rap);
  1827. X  
  1828. X      code = lDump(id, "dump");
  1829. X!     fprintf(stdout, "lDump : %d\\n", code);
  1830. X  
  1831. X      lDel(id);
  1832. X  
  1833. X      id = lUndump("dump");
  1834. X!     fprintf(stdout, "lUndump : %d\\n", id);
  1835. X  
  1836. X      insRap(id, lFIRST, 4, "Book 4", "The Author", 891127);
  1837. X  
  1838. X      prRapAll(id);
  1839. X  
  1840. X!     fprintf(stdout, "lFndFlagNode\\n");
  1841. X      code = lFndFlagNode(id, lFIRST, 1, &rap, rapSz);
  1842. X      prRap(code, &rap);
  1843. X      code = lFndFlagNode(id, lNEXT, 1, &rap, rapSz);
  1844. X***************
  1845. X*** 146,159 ****
  1846. X      code = lFndFlagNode(id, lFIRST, 7, &rap, rapSz);
  1847. X      prRap(code, &rap);
  1848. X      
  1849. X!     fprintf(stdout, "Untouched list\n");
  1850. X      prRapAll(id);
  1851. X  
  1852. X!     fprintf(stdout, "lSort\n");
  1853. X      lSort(id, lDESCENDING, lBUBBLE, compare);
  1854. X      prRapAll(id);
  1855. X  
  1856. X!     fprintf(stdout, "lSort\n");
  1857. X      lSort(id, lASCENDING, lHEAP, compare);
  1858. X      prRapAll(id);
  1859. X  
  1860. X--- 159,172 ----
  1861. X      code = lFndFlagNode(id, lFIRST, 7, &rap, rapSz);
  1862. X      prRap(code, &rap);
  1863. X      
  1864. X!     fprintf(stdout, "Untouched list\\n");
  1865. X      prRapAll(id);
  1866. X  
  1867. X!     fprintf(stdout, "lSort\\n");
  1868. X      lSort(id, lDESCENDING, lBUBBLE, compare);
  1869. X      prRapAll(id);
  1870. X  
  1871. X!     fprintf(stdout, "lSort\\n");
  1872. X      lSort(id, lASCENDING, lHEAP, compare);
  1873. X      prRapAll(id);
  1874. X  
  1875. X***************
  1876. X*** 162,169 ****
  1877. X  
  1878. X  static void
  1879. X  insRap(id, where, flag, title, author, date)
  1880. X! int    id, where, flag, date;
  1881. X! char    *title, *author;
  1882. X  {
  1883. X      int        code;
  1884. X      Rapport    rap;
  1885. X--- 175,182 ----
  1886. X  
  1887. X  static void
  1888. X  insRap(id, where, flag, title, author, date)
  1889. X! int        id, where, flag, date;
  1890. X! char        *title, *author;
  1891. X  {
  1892. X      int        code;
  1893. X      Rapport    rap;
  1894. X***************
  1895. X*** 195,204 ****
  1896. X  Rapport        *rpprt;
  1897. X  {
  1898. X      if (code >= 0)
  1899. X!         fprintf(stdout, "Rapport : '%s' '%s' '%d'\n", rpprt->title,
  1900. X              rpprt->author, rpprt->date);
  1901. X      else
  1902. X!         fprintf(stdout, "Return code = %d\n", code);
  1903. X  }
  1904. X  
  1905. X  static int
  1906. X--- 208,217 ----
  1907. X  Rapport        *rpprt;
  1908. X  {
  1909. X      if (code >= 0)
  1910. X!         fprintf(stdout, "Rapport : '%s' '%s' '%d'\\n", rpprt->title,
  1911. X              rpprt->author, rpprt->date);
  1912. X      else
  1913. X!         fprintf(stdout, "Return code = %d\\n", code);
  1914. X  }
  1915. X  
  1916. X  static int
  1917. X***************
  1918. X*** 226,281 ****
  1919. X          return(l1LT2);    /* key1 < key2 */
  1920. X  }
  1921. X  .fi
  1922. X- .sp 2
  1923. X- This example program produces the following output :
  1924. X- .nf
  1925. X-     lGetNode
  1926. X-     Rapport : 'Book 2' 'More People' '890130'
  1927. X-     Rapport : 'Book 1' 'People' '890129'
  1928. X-     Rapport : 'Book 3' 'Lots of People' '890131'
  1929. X-     Return code = -9
  1930. X-     lGetIndxNode
  1931. X-     Return code = -13
  1932. X-     Rapport : 'Book 1' 'People' '890129'
  1933. X-     Return code = -13
  1934. X-     Rapport : 'Book 3' 'Lots of People' '890131'
  1935. X-     lFndNode
  1936. X-     Rapport : 'Book 2' 'More People' '890130'
  1937. X-     Rapport : 'Book 3' 'Lots of People' '890131'
  1938. X-     Return code = -10
  1939. X-     lDump : 0
  1940. X-     lUndump : 1
  1941. X-     Rapport : 'Book 4' 'The Author' '891127'
  1942. X-     Rapport : 'Book 2' 'More People' '890130'
  1943. X-     Rapport : 'Book 1' 'People' '890129'
  1944. X-     Rapport : 'Book 3' 'Lots of People' '890131'
  1945. X-     Return code = -9
  1946. X-     lFndFlagNode
  1947. X-     Rapport : 'Book 1' 'People' '890129'
  1948. X-     Rapport : 'Book 3' 'Lots of People' '890131'
  1949. X-     Rapport : 'Book 2' 'More People' '890130'
  1950. X-     Return code = -10
  1951. X-     Untouched list
  1952. X-     Rapport : 'Book 4' 'The Author' '891127'
  1953. X-     Rapport : 'Book 2' 'More People' '890130'
  1954. X-     Rapport : 'Book 1' 'People' '890129'
  1955. X-     Rapport : 'Book 3' 'Lots of People' '890131'
  1956. X-     Return code = -9
  1957. X-     lSort
  1958. X-     Rapport : 'Book 4' 'The Author' '891127'
  1959. X-     Rapport : 'Book 1' 'People' '890129'
  1960. X-     Rapport : 'Book 2' 'More People' '890130'
  1961. X-     Rapport : 'Book 3' 'Lots of People' '890131'
  1962. X-     Return code = -9
  1963. X-     lSort
  1964. X-     Rapport : 'Book 3' 'Lots of People' '890131'
  1965. X-     Rapport : 'Book 2' 'More People' '890130'
  1966. X-     Rapport : 'Book 1' 'People' '890129'
  1967. X-     Rapport : 'Book 4' 'The Author' '891127'
  1968. X-     Return code = -9
  1969. X- .fi
  1970. X  .SH VERSION
  1971. X! Generic Linked List 0.8, March 1993.
  1972. X  .SH PUBLIC DOMAIN
  1973. X  The Generic Linked List package is in the public domain. If you have
  1974. X  any comments, suggestions, or find any bugs, or make any changes you'd
  1975. X--- 239,246 ----
  1976. X          return(l1LT2);    /* key1 < key2 */
  1977. X  }
  1978. X  .fi
  1979. X  .SH VERSION
  1980. X! Generic Linked List 0.9, May 1993.
  1981. X  .SH PUBLIC DOMAIN
  1982. X  The Generic Linked List package is in the public domain. If you have
  1983. X  any comments, suggestions, or find any bugs, or make any changes you'd
  1984. X*** ../Doc/lDef.3    Fri Feb 26 10:30:43 1993
  1985. X--- Doc/lDef.3    Thu May 27 12:01:53 1993
  1986. X***************
  1987. X*** 27,32 ****
  1988. X--- 27,33 ----
  1989. X      lDOUBLY    doubly linked list, each node points to the previous and
  1990. X          the next node
  1991. X  .fi
  1992. X+ .sp 1
  1993. X  \fIcc\fP :
  1994. X  .nf
  1995. X      lCHAIN    chain linked list, last node has a NULL-pointer
  1996. X*** ../Doc/lFndFlagNode.3    Fri Feb 26 10:38:09 1993
  1997. X--- Doc/lFndFlagNode.3    Thu May 27 12:01:53 1993
  1998. X***************
  1999. X*** 5,11 ****
  2000. X  lFndFlagNode - Get node by flag.
  2001. X  .SH SYNOPSIS
  2002. X  int
  2003. X! .BR "lFndFlagNode" "(id, from, flag, data, size)"
  2004. X  .br
  2005. X  .RT
  2006. X  .RP
  2007. X--- 5,11 ----
  2008. X  lFndFlagNode - Get node by flag.
  2009. X  .SH SYNOPSIS
  2010. X  int
  2011. X! .BR "lFndFlagNode" "(id, which, flag, data, size)"
  2012. X  .br
  2013. X  .RT
  2014. X  .RP
  2015. X***************
  2016. X*** 12,18 ****
  2017. X  In    int    id    identifier of linked list
  2018. X  .br
  2019. X  .RP
  2020. X! In    int    from    from where must be searched
  2021. X  .br
  2022. X  .RP
  2023. X  In    int    flag    flag of node which must be retrieved
  2024. X--- 12,18 ----
  2025. X  In    int    id    identifier of linked list
  2026. X  .br
  2027. X  .RP
  2028. X! In    int    which    from which node must be searched and in which direction
  2029. X  .br
  2030. X  .RP
  2031. X  In    int    flag    flag of node which must be retrieved
  2032. X***************
  2033. X*** 25,47 ****
  2034. X  .DT
  2035. X  .SH DESCRIPTION
  2036. X  \fBlFndFlagNode\fP searches a 'flagged' node from the linked list. From
  2037. X! where the node must be searched can be specified by \fIfrom\fP. A node
  2038. X! can be searched forward from the beginning of the list or from the
  2039. X! current node and backward from the current node or from the end of the
  2040. X! list.
  2041. X  .br
  2042. X  Backward searching is only possible for doubly linked list.
  2043. X  .br
  2044. X  When the found node is the first or the last node, the return code will
  2045. X  have the value lFIRST or lLAST, otherwise lFOUND.
  2046. X  .SH PARAMETER DEFINITIONS
  2047. X  .if t .ta 0.2i 1.5i
  2048. X! \fIfrom\fP :
  2049. X  .nf
  2050. X!     lFIRST    search forward from first node
  2051. X!     lPREVIOUS    search backward from previous node
  2052. X!     lNEXT    search forward from next node
  2053. X!     lLAST    search backward from last node
  2054. X  .fi
  2055. X  .SH RETURN CODES
  2056. X  .nf
  2057. X--- 25,51 ----
  2058. X  .DT
  2059. X  .SH DESCRIPTION
  2060. X  \fBlFndFlagNode\fP searches a 'flagged' node from the linked list. From
  2061. X! which node the searching must start and in which direction must be
  2062. X! searched can be specified by \fIwhich\fP. A node can be searched forward
  2063. X! from the beginning of the list (lFIRST) or from the current node (lNEXT)
  2064. X! and backward from the end of the list (lLAST) or from the current node
  2065. X! (lPREVIOUS).
  2066. X  .br
  2067. X  Backward searching is only possible for doubly linked list.
  2068. X  .br
  2069. X  When the found node is the first or the last node, the return code will
  2070. X  have the value lFIRST or lLAST, otherwise lFOUND.
  2071. X+ When the linked list contains only one node, the return code will have
  2072. X+ the value lFIRST, when searching backward, and the value lLAST, when
  2073. X+ searching forward.
  2074. X  .SH PARAMETER DEFINITIONS
  2075. X  .if t .ta 0.2i 1.5i
  2076. X! \fIwhich\fP :
  2077. X  .nf
  2078. X!     lFIRST    search forward starting from the first node
  2079. X!     lNEXT    search forward starting from the next node
  2080. X!     lLAST    search backward starting from the last node
  2081. X!     lPREVIOUS    search backward starting from the previous node
  2082. X  .fi
  2083. X  .SH RETURN CODES
  2084. X  .nf
  2085. X***************
  2086. X*** 48,54 ****
  2087. X  Return on success :
  2088. X      lFOUND, lFIRST, lLAST, lNOT_FOUND
  2089. X  Return on error :
  2090. X!     lUNKNOWN_ID, lEMPTY_LIST, lWRONG_FROM, lSIZE_NE
  2091. X  .fi
  2092. X  .SH AUTHOR
  2093. X  Anita Eijs (TNO - Bouw - BouwInformatica)
  2094. X--- 52,58 ----
  2095. X  Return on success :
  2096. X      lFOUND, lFIRST, lLAST, lNOT_FOUND
  2097. X  Return on error :
  2098. X!     lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lSIZE_NE
  2099. X  .fi
  2100. X  .SH AUTHOR
  2101. X  Anita Eijs (TNO - Bouw - BouwInformatica)
  2102. X*** ../Doc/lFndNode.3    Fri Feb 26 10:47:50 1993
  2103. X--- Doc/lFndNode.3    Thu May 27 12:01:53 1993
  2104. X***************
  2105. X*** 5,11 ****
  2106. X  lFndNode - Find node.
  2107. X  .SH SYNOPSIS
  2108. X  int
  2109. X! .BR "lFndNode" "(id, from, func, ptr, data, size)"
  2110. X  .br
  2111. X  .RT
  2112. X  .RP
  2113. X--- 5,11 ----
  2114. X  lFndNode - Find node.
  2115. X  .SH SYNOPSIS
  2116. X  int
  2117. X! .BR "lFndNode" "(id, which, func, ptr, data, size)"
  2118. X  .br
  2119. X  .RT
  2120. X  .RP
  2121. X***************
  2122. X*** 12,18 ****
  2123. X  In    int    id    identifier of linked list
  2124. X  .br
  2125. X  .RP
  2126. X! In    int    from    from where must be searched
  2127. X  .br
  2128. X  .RP
  2129. X  In    int    (*func)()    function for checking the data on conditions
  2130. X--- 12,18 ----
  2131. X  In    int    id    identifier of linked list
  2132. X  .br
  2133. X  .RP
  2134. X! In    int    which    from which node must be searched and in which direction
  2135. X  .br
  2136. X  .RP
  2137. X  In    int    (*func)()    function for checking the data on conditions
  2138. X***************
  2139. X*** 28,55 ****
  2140. X  .DT
  2141. X  .SH DESCRIPTION
  2142. X  \fBlFndNode\fP searches a node from the linked list, using the user
  2143. X! defined serach function \fIfunc\fP, which checks the data of a node
  2144. X  on conditions. This function must have two parameters, a pointer to
  2145. X  the data to compare with and a pointer to the data of a node. The
  2146. X  possible return values are lFOUND or lNOT_FOUND. See the introduction
  2147. X  of Generic Linked List for an example of such a search function. From
  2148. X! where the node must be searched can be specified by \fIfrom\fP. A node
  2149. X! can be searched forward from the beginning of the list or from the
  2150. X! current node and backward from the current node or from the end of the
  2151. X! list.
  2152. X  .br
  2153. X  Backward searching is only possible for doubly linked list.
  2154. X  .br
  2155. X  When the found node is the first or the last node, the return code will
  2156. X  have the value lFIRST or lLAST, otherwise lFOUND.
  2157. X  .SH PARAMETER DEFINITIONS
  2158. X  .if t .ta 0.2i 1.5i
  2159. X! \fIfrom\fP :
  2160. X  .nf
  2161. X!     lFIRST    search forward from first node
  2162. X!     lPREVIOUS    search backward from previous node
  2163. X!     lNEXT    search forward from next node
  2164. X!     lLAST    search backward from last node
  2165. X  .fi
  2166. X  .SH RETURN CODES
  2167. X  .nf
  2168. X--- 28,59 ----
  2169. X  .DT
  2170. X  .SH DESCRIPTION
  2171. X  \fBlFndNode\fP searches a node from the linked list, using the user
  2172. X! defined search function \fIfunc\fP, which checks the data of a node
  2173. X  on conditions. This function must have two parameters, a pointer to
  2174. X  the data to compare with and a pointer to the data of a node. The
  2175. X  possible return values are lFOUND or lNOT_FOUND. See the introduction
  2176. X  of Generic Linked List for an example of such a search function. From
  2177. X! which node the searching must start and in which direction must be
  2178. X! searched can be specified by \fIwhich\fP. A node can be searched
  2179. X! forward from the beginning of the list (lFIRST) or from the current
  2180. X! node (lNEXT) and backward from the end of the list (lLAST) or from
  2181. X! the current node (lPREVIOUS).
  2182. X  .br
  2183. X  Backward searching is only possible for doubly linked list.
  2184. X  .br
  2185. X  When the found node is the first or the last node, the return code will
  2186. X  have the value lFIRST or lLAST, otherwise lFOUND.
  2187. X+ When the linked list contains only one node, the return code will have
  2188. X+ the value lFIRST, when searching backward, and the value lLAST, when
  2189. X+ searching forward.
  2190. X  .SH PARAMETER DEFINITIONS
  2191. X  .if t .ta 0.2i 1.5i
  2192. X! \fIwhich\fP :
  2193. X  .nf
  2194. X!     lFIRST    search forward starting from the first node
  2195. X!     lNEXT    search forward starting from the next node
  2196. X!     lLAST    search backward starting from the last node
  2197. X!     lPREVIOUS    search backward starting from the previous node
  2198. X  .fi
  2199. X  .SH RETURN CODES
  2200. X  .nf
  2201. X***************
  2202. X*** 58,64 ****
  2203. X  Return on error :
  2204. X  .fi
  2205. X  .in +0.2i
  2206. X! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_FROM, lUNKNOWN_FUNC, lNOT_DOUBLY
  2207. X! .in 10.2i
  2208. X  .SH AUTHOR
  2209. X  Anita Eijs (TNO - Bouw - BouwInformatica)
  2210. X--- 62,68 ----
  2211. X  Return on error :
  2212. X  .fi
  2213. X  .in +0.2i
  2214. X! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lNOT_DOUBLY, lUNKNOWN_FUNC
  2215. X! .in -0.2i
  2216. X  .SH AUTHOR
  2217. X  Anita Eijs (TNO - Bouw - BouwInformatica)
  2218. X*** ../Doc/lGetNode.3    Fri Feb 26 10:43:42 1993
  2219. X--- Doc/lGetNode.3    Thu May 27 12:01:53 1993
  2220. X***************
  2221. X*** 29,34 ****
  2222. X--- 29,37 ----
  2223. X  When the retrieved node is the first or the last node, the return code
  2224. X  will have the value lFIRST or lLAST. For the other nodes the routine
  2225. X  returns lSUCCESS.
  2226. X+ When the linked list contains only one node, the return code will have
  2227. X+ the value lFIRST, when retrieving backward, and the value lLAST, when
  2228. X+ retrieving forward.
  2229. X  .SH PARAMETER DEFINITIONS
  2230. X  .if t .ta 0.2i 1.5i
  2231. X  \fIwhich\fP :
  2232. X***************
  2233. X*** 45,52 ****
  2234. X      lSUCCESS, lFIRST, lLAST
  2235. X  Return on error :
  2236. X  .fi
  2237. X! .in +02.i
  2238. X! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lEOL, lNOT_DOUBLY, lSIZE_NE
  2239. X! .in -02.i
  2240. X  .SH AUTHOR
  2241. X  Anita Eijs (TNO - Bouw - BouwInformatica)
  2242. X--- 48,55 ----
  2243. X      lSUCCESS, lFIRST, lLAST
  2244. X  Return on error :
  2245. X  .fi
  2246. X! .in +0.2i
  2247. X! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lEOL, lSIZE_NE, lNOT_DOUBLY
  2248. X! .in -0.2i
  2249. X  .SH AUTHOR
  2250. X  Anita Eijs (TNO - Bouw - BouwInformatica)
  2251. X*** ../Doc/lInfoNode.3    Fri Feb 26 10:44:07 1993
  2252. X--- Doc/lInfoNode.3    Thu May 27 12:01:53 1993
  2253. X***************
  2254. X*** 44,50 ****
  2255. X  Return on error :
  2256. X  .fi
  2257. X  .in +0.2i
  2258. X! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lEOL, lNOT_DOUBLY
  2259. X  .in -0.2i
  2260. X  .SH AUTHOR
  2261. X  Anita Eijs (TNO - Bouw - BouwInformatica)
  2262. X--- 44,50 ----
  2263. X  Return on error :
  2264. X  .fi
  2265. X  .in +0.2i
  2266. X! lUNKNOWN_ID, lEMPTY_LIST, lWRONG_WHICH, lNOT_DOUBLY, lEOL
  2267. X  .in -0.2i
  2268. X  .SH AUTHOR
  2269. X  Anita Eijs (TNO - Bouw - BouwInformatica)
  2270. X*** ../Doc/lSort.3    Mon Apr 19 13:49:00 1993
  2271. X--- Doc/lSort.3    Thu May 27 12:01:53 1993
  2272. X***************
  2273. X*** 15,21 ****
  2274. X  .RP
  2275. X  In    int    theory    sorting theory
  2276. X  .RP
  2277. X! In    int    (*func)()    function for comparing the data of 2 nodes
  2278. X  .DT
  2279. X  .SH DESCRIPTION
  2280. X  \fBlSort\fP sorts a linked list in the specified \fIorder\fP, using
  2281. X--- 15,21 ----
  2282. X  .RP
  2283. X  In    int    theory    sorting theory
  2284. X  .RP
  2285. X! In    int    (*func)()    function for comparing the data of two nodes
  2286. X  .DT
  2287. X  .SH DESCRIPTION
  2288. X  \fBlSort\fP sorts a linked list in the specified \fIorder\fP, using
  2289. X***************
  2290. X*** 31,43 ****
  2291. X      lASCENDING    'a', 'b', 'c', ...
  2292. X      lDESCENDING    'z', 'y', 'x', ...
  2293. X  .fi
  2294. X  \fItheory\fP :
  2295. X  .nf
  2296. X!     lBUBBLE    bubble sorting algorithm ...
  2297. X!     lHEAP    heap sorting algorithm ...
  2298. X!     lINSERT    insert sorting algorithm ...
  2299. X!     lQUICK    quick sorting algorithm ...
  2300. X!     lSELECTION    selection sorting algorithm ...
  2301. X  .fi
  2302. X  .SH RETURN CODES
  2303. X  .nf
  2304. X--- 31,44 ----
  2305. X      lASCENDING    'a', 'b', 'c', ...
  2306. X      lDESCENDING    'z', 'y', 'x', ...
  2307. X  .fi
  2308. X+ .sp 1
  2309. X  \fItheory\fP :
  2310. X  .nf
  2311. X!     lBUBBLE    bubble sorting algorithm
  2312. X!     lHEAP    heap sorting algorithm
  2313. X!     lINSERT    insert sorting algorithm
  2314. X!     lQUICK    quick sorting algorithm
  2315. X!     lSELECTION    selection sorting algorithm
  2316. X  .fi
  2317. X  .SH RETURN CODES
  2318. X  .nf
  2319. END_OF_FILE
  2320.   if test 50341 -ne `wc -c <'patch1'`; then
  2321.     echo shar: \"'patch1'\" unpacked with wrong size!
  2322.   fi
  2323.   # end of 'patch1'
  2324. fi
  2325. echo shar: End of archive 1 \(of 1\).
  2326. cp /dev/null ark1isdone
  2327. MISSING=""
  2328. for I in 1 ; do
  2329.     if test ! -f ark${I}isdone ; then
  2330.     MISSING="${MISSING} ${I}"
  2331.     fi
  2332. done
  2333. if test "${MISSING}" = "" ; then
  2334.     echo You have the archive.
  2335.     rm -f ark[1-9]isdone
  2336. else
  2337.     echo You still must unpack the following archives:
  2338.     echo "        " ${MISSING}
  2339. fi
  2340. exit 0
  2341. exit 0 # Just in case...
  2342.